import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1

Window {
    visible: true;
    width: 700;
    height: 500;

    Rectangle {
        anchors.fill: parent;

        FileDialog {
            id: fileDialog;
            title: "Please choose a file";
            selectFolder: true;

            onAccepted: {
                fdir.text = fileDialog.folder;
                console.log("fileUrls: " + fileDialog.fileUrls)
            }
        }

        Text {
            id: fdir;
            anchors.bottom: parent.bottom;
            anchors.bottomMargin: 10;
            anchors.horizontalCenter: parent.horizontalCenter;

            color: "lightskyblue";

            font {
                weight: Font.Light;
                family: "Mycrosoft Yahei";
                pixelSize: 25;
            }
        }

        Button {
            anchors.centerIn: parent;
            width: 100;
            height: 40;

            style: ButtonStyle{
                background: Rectangle {
                    anchors.fill: parent;
                    color: "lightskyblue";

                    border.width: control.pressed ? 2 : 1;
                    border.color: control.pressed ? "white" : "lightskyblue";

                    Text {
                        anchors.centerIn: parent;
                        text: "Click";
                        color: "white";
                        font {
                            family: "Mycrosoft Yahei";
                            weight: Font.Light;
                            pixelSize: 20;
                        }
                    }
                }
            }

            onClicked: {
                fileDialog.open();
            }
        }
    }
}
